package com.madixin.madichat

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.ui.Modifier
import com.madixin.madichat.ui.navigation.NavGraph
import com.madixin.madichat.ui.theme.MadichatTheme
import com.madixin.madichat.util.PreferencesManager

class MainActivity : ComponentActivity() {
    private lateinit var preferencesManager: PreferencesManager
    
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        
        // 初始化PreferencesManager
        preferencesManager = PreferencesManager(applicationContext)
        
        setContent {
            MadichatTheme {
                // A surface container using the 'background' color from the theme
                Surface(
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colors.background
                ) {
                    // 使用NavGraph替换原来的Greeting组件
                    NavGraph(preferencesManager = preferencesManager)
                }
            }
        }
    }
}
